home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group02b.txt
/
000014_icon-group-sender_Mon Aug 19 12:51:49 2002.msg
< prev
next >
Wrap
Internet Message Format
|
2003-01-02
|
3KB
Return-Path: <icon-group-sender>
Received: (from root@localhost)
by baskerville.CS.Arizona.EDU (8.11.1/8.11.1) id g7JJplQ13392
for icon-group-addresses; Mon, 19 Aug 2002 12:51:47 -0700 (MST)
Message-Id: <200208191951.g7JJplQ13392@baskerville.CS.Arizona.EDU>
From: Hrvoje Blazevic <hrvoje@despammed.com>
X-Newsgroups: comp.lang.icon
Subject: Re: What about "Expressions?" (was Re: Icon Wish List)
Date: Sat, 17 Aug 2002 09:16:19 +0200
X-Complaints-To: abuse@hinet.hr
User-Agent: Pan/0.11.2 (Unix)
X-Comment-To: "Gene Kahn" <jenjhiz@yahoo.com>
To: icon-group@cs.arizona.edu
Errors-To: icon-group-errors@cs.arizona.edu
Status: RO
On Fri, 16 Aug 2002 17:38:22 +0200, Gene Kahn wrote:
>> Statements do not return values, they have side-effects, most notably
>> assignment to variables that describe the state of the computation at
>> any given moment.
>>
> This is not without its advantage, of course. In particular, in terms of
> readability, I find that explicit variables allow my mind to 'close'
> (I'm not using it in the technical sense of "closure") previous
> statements. On the other hand, in reading s-expression languages like
> Lisp and Scheme, I find that I have to hold in my mind too many
> _unstated_ intermediate results before I find what the expression is all
> about. (One could argue that this may be due more to bad code, i.e.,
> irresponsible use of deep embedding, than to intrinsic properties of
> s-expressions). Compare the readability of these chunks of code:
>
> FORTRAN-like
> The man kicked the dog.
> The dog chased the cat.
> The cat bit the mouse.
> The mouse died.
>
> LISP-like (in infix notation)
> The mouse the cat the dog the man kicked chased bit died.
Well -- this comparison is very unfair, a favorite imperative
programmer's trick. I do not mean this in derogatory way. In the
meantime I have checked your web-site, and have found a lot of
interesting material, quite a lot of common interest.
In these two examples you are deliberately confusing programming
languages, and human languages. Human languages are not formal
systems, while programming languages are. When you force yourself
(difficult in this example) to forget about standard meaning of
English words, then the second example can make more sense than the
first.
Phew -- I had to reach for GEB (Goedel Escher Bach) to answer this
one.
But let's go back to programming paradigms;
Unfortunately, most programmers, and students would agree with you --
following the state of variables is easier to understand, than holding
a deep recursive structure in the head. I did have problems with this
when I started with Logo and Scheme. However, given enough of
endurance and several good books (and interestingly enough books from
FP camp seem to be an order of magnitude better than those from
imperative camp), one can stop trying to reason about processes that
recursive procedures carry out in the terms of remembering values, and
switch to the higher level of simply following the definitions of data
structures that those processes work on.
When one is able to do this, imperative style all of the sudden starts
looking complicated and mind limiting.
I will not bother you with very good arguments of when and where
assignment is appropriate, and what are its advantages and
drawbacks. (there are more drawbacks -- of course :-)
All this is very thoroughly described in HtDP and SICP.